<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Document</title>
</head>
<body>
  <div id="app">
    <label for="age">age</label>
    <!-- 将有效的输入字符串转换为数字 -->
    <input id="age" type="text" v-model.number='age'><br>
    <label for="info">info</label>
    <input id="info" type="text" v-model.trim='info'><br>
    <label for="msg">msg</label>
    <!-- 监听change事件而不是input -->
    <input id="msg" type="text" v-model.lazy='msg'><br>
    <div>{{msg}}</div>
    <button @click='handle'>点击</button>
  </div>
  <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
  <script type="text/javascript">
    /*
      表单域修饰符
    */
    var vm = new Vue({
      el: '#app',
      data: {
        age: '',
        info: '',
        msg: ''
      },
      methods: {
        handle: function () {
          console.log('32' + 21);
          console.log(`typeof this.age: ${typeof this.age}  ${this.age + 13}`)
          console.log(`info.length: ${this.info.length}`)
        }
      }
    });
  </script>
</body>
</html>
